
#pragma once

#include <stdint.h>
#include <stdio.h>

//
// file data types
//

typedef uint32_t    FileChar;
typedef int32_t     FileOffset;
typedef int32_t     FileInt;


#pragma pack(push, 1)

struct FileHeader
{
    FileOffset  root_node_offset;
    FileOffset  tree_block_size;
};



struct FileEntry
{
    FileChar    character;

    FileOffset  node_offset;
};

struct FileNode
{
    FileOffset  parent_node_offset;

    FileInt     entry_count;
};

#pragma pack(pop)


//
// restores file tree
//

struct FileDb;

struct FileDb * load_file_db(FILE * fsrc);

void free_file_db(struct FileDb * db);

void file_db_print_all(struct FileDb * db);
